package test;
//猜数字游戏
import java.util.Random;
import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Random r = new Random();
        int n = r.nextInt(100)+1;
        Scanner sc =new Scanner(System.in);
        int count=0;
        while(true){
            System.out.println("请输入你要猜的数：");
            int number =sc.nextInt();
            count++;
            if(count==3){
                System.out.println("恭喜你，猜对了！");
                break;
            }
            if(number == n){
                System.out.println("恭喜你，猜对了！");
                break;
            }else if(number >n){
                System.out.println("猜大了");
            }else{
                System.out.println("猜小了");
            }
        }
    }
}
